	$(document).ready(function(){
		$("#user").on("change", function(){
			var id = $(this).val();
			if(id != 0){
				$.ajax({
					dataType: "json",
					url: "InformationUserServlet",
					data: {userId: id},
					success: function(data){
						$('#email').val(data.email);
						$('#name').val(data.name);
						$('#surname').val(data.surname);
						$('#address').val(data.address);
						$('#pesel').val(data.pesel);
					}
				});
			} else {
				$('#email').val("");
				$('#name').val("");
				$('#surname').val("");
				$('#address').val("");
				$('#pesel').val("");
			}
		});	
	
	});